#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#include "armsdkcli.h"
#include "armsdkerr.h"
#include "armsdkmod.h"
#include "armsdkcmdregister.h"
#include "uart.h"
#include "uartcli.h"
#include "uartglob.h"
#include "uartcmdregister.h"
#include "uartcmdfuncdeclare.h"
#include "esp8266.h"


ARM_CMD("enable", uart_enable_str)
{
    PRINTF("enabled uart function...\n");
    uartEnable();

    return SUCCESS;
}

ARM_CMD("disable", uart_disable_str)
{
    PRINTF("disable uart function...\n");
    uartDisable();

    return SUCCESS;
}

ARM_CMD("quit", uart_quit_str)
{
    ARM_CMD_PROMPT_QUIT();

    return SUCCESS;
}

ARM_CMD("esp8266", esp8266_func_str)
{
    /*进入esp8266命令行*/
    if (uartgetState() == FALSE)
    {
        PRINTF("uart function not enabled\n");
        return FAILURE;
    }

    esp8266Cmd();

    return SUCCESS;
}

INT4 uartSDKCmdRegister()
{
    uartCmdStrRegister(uart_enable_str);
    uartCmdStrRegister(uart_disable_str);
    uartCmdStrRegister(uart_quit_str);
    uartCmdStrRegister(esp8266_func_str);

    return SUCCESS;
}

